﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ArraysAndStrings.ReverseWords2
{
    class MainPorject
    {
        static void Main(string[] args)
        {
            Console.WriteLine(ReverseWords("Let's take LeetCode contest"));
            Console.ReadKey();
        }
        public static string ReverseWords(string s)
        {
            string[] strs = s.Split(' ');
            string str = string.Empty;
            foreach (var item in strs)
            {
                char[] chars = item.ToCharArray();
                Array.Reverse(chars);
                for (int i = 0; i < chars.Length; i++)
                {
                    str += chars[i];
                }
                str += ' ';
            }
            return str.Trim();
        }
    }
}
